//package com.yanfan.parking;
//
//
//import com.alibaba.fastjson2.JSON;
//import com.alibaba.fastjson2.JSONObject;
//import com.yanfan.ibms.common.utils.HttpUtil;
//import com.yanfan.ibms.common.utils.HttpUtils2;
//import com.yanfan.parking.domain.IbmsParkingPlace;
//import com.yanfan.parking.domain.IbmsParkingRecords;
//import com.yanfan.parking.service.IIbmsParkingPlaceService;
//import com.yanfan.parking.service.IIbmsParkingRecordsService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.HashMap;
//import java.util.List;
//
//@RestController
//@Api(tags = "上海停车场系统对接api")
//@RequestMapping
//@Component("parking")
//public class ApiController {
//
//    @Autowired
//    private IIbmsParkingRecordsService ibmsVehicleInOutRecordService;
//
//    @Autowired
//    private IIbmsParkingPlaceService iIbmsParkingPlaceService;
//
//
////    /**
////     * 停车场进出记录
////     * @param ibmsParkingRecords
////     * @return
////     */
////    @ApiOperation("上传车辆进出记录")
////    @PostMapping("/AddInOrOutRecords")
////    public JSONObject parkingRecords(@RequestBody IbmsParkingRecords ibmsParkingRecords){
////        System.out.println(ibmsParkingRecords.toString());
////        ibmsVehicleInOutRecordService.save(ibmsParkingRecords);
////        JSONObject result = new JSONObject();
////        result.put("resCode",0);
////        result.put("resMsg","成功");
////        return result;
////    }
//
//
//    /**
//     * 获取服务器上停车场子系统停车场信息，并将信息添加到本地数据
//     * @param ibmsParkingPlace
//     */
//
//
//    public  void parkingAddCarparkDetails(@RequestBody IbmsParkingPlace ibmsParkingPlace){
//
//        // 发送POST请求
//        HashMap<String, Object> stringObjectHashMap = new HashMap<>();
//        stringObjectHashMap.put("stationNo","59");
//
//        JSONObject jsonObject = HttpUtils2
//                .sendPostBody("http://10.22.10.249:9988/Parking/Handheld/GetParkingLotInfo",
//                        null, stringObjectHashMap);
//        Object object = jsonObject.get("parkingLotInfo");
//        List<IbmsParkingPlace> list = JSON.parseArray(object.toString(), IbmsParkingPlace.class);
//        for (IbmsParkingPlace ibmsParkingPlaces : list) {
//            ibmsParkingPlaces.setChargeRuleDesc(jsonObject.get("chargeRuleDesc").toString());
//        }
//        //批量更新或新增到数据
//        iIbmsParkingPlaceService.saveOrUpdateBatch(list);
//
//    }
//
//
//
//}
